sub initialize_lattice {

	# Pretty arguments.
	($args) = @_;

	# Create the network.
	$network = insj_m_network->new(name => 'Lattice infection network');
	
	# Connect the network.
	
	$x_axis = $args->{'x'};
	$y_axis = $args->{'y'};

	# Initialize Nodes.
	for($x = 1; $x <= $x_axis; $x++){
		for($y = 1; $y <= $y_axis; $y++){
			$node = $network->create_node( name=> $x.";".$y );
			}               
		}
	
	# Connect Nodes.
	for($x=1;$x<=$x_axis;$x++){
		for($y=1;$y<=$y_axis;$y++){

			$node=$network->get_node($x.";".$y);

			# X-Axis
			if($x==1){
				$node->add_node($network->get_node(($x+1).";".$y));
				}
			elsif($x==$x_axis){
				$node->add_node($network->get_node(($x-1).";".$y));
				}
			else{
				$node->add_node($network->get_node(($x+1).";".$y));
				$node->add_node($network->get_node(($x-1).";".$y));
				}

			# Y-Axis
			if($y==1){
				$node->add_node($network->get_node($x.";".($y+1)));
				}
			elsif($y==$y_axis){
				$node->add_node($network->get_node($x.";".($y-1)));
				}
			else{
				$node->add_node($network->get_node($x.";".($y+1)));
				$node->add_node($network->get_node($x.";".($y-1)));
				}

			}
		}
	return $network;

	}

1;
